package com.vdong.trade.order.repository;

import com.vdong.trade.order.entity.dto.param.*;
import com.vdong.trade.order.entity.mo.*;
import com.vdong.trade.order.entity.po.CountOrderPO;
import org.apache.ibatis.annotations.Mapper;
import org.lamb.framework.core.supper.LambRepository;

import java.util.List;
import java.util.Optional;

/**
 * @description: 订单持久层
 * @author: Mr.WangGang
 * @create: 2018-11-29 下午 12:13
 **/
@Mapper
public interface OrderMORepository extends LambRepository<OrderMO> {

    Optional<OrderMO> findByOrderNoAndStatus(String orderNo, String status);

    OrderMO selectOrderByEntity(OrderMO orderMO);

    /**
     * 将数据插入到数据库
     *
     * @param tOrder
     * @return 返回成功新增的个数
     */
    int insertOrder(OrderMO tOrder);

    /**
     * 根据ID删除数据
     *
     * @param id
     * @return 返回成功删除记录的个数
     */
    int deleteOrderById(Long id);

    /**
     * 根据ID修改数据
     *
     * @param id
     * @return 返回成功修改记录的个数
     */
    int updateOrderById(OrderMO tOrder);

    /**
     * 根据ID查询数据
     *
     * @param id
     * @return 返回成功查询记录
     */
    OrderMO selectOrderById(Long id);

    /**
     * 根据条件查询数据
     *
     * @param tOrder
     * @return 返回查询的记录列表
     */
    List<OrderMO> selectOrderListByCond(OrderMO tOrder);

    /**
     * 根据条件查询数据的条数
     *
     * @param tOrder
     * @return 返回查询的记录条数
     */
    Integer selectOrderCntByCond(OrderMO tOrder);

    List<ChannelCurveMO> channelCurve(ChannelCurveParamDTO param);

    List<DistributionOrdersMO> distributionOrderList(DistributionOrdersParamDTO param);

    DistributionOrderDetailMO distributionOrderDetail(DistributionOrdersParamDTO param);

    List<DetailEarningListMO> DetailEarningList(DistributionOrdersParamDTO param);

    DetailEarningDetailMO DetailEarningDetail(DistributionOrdersParamDTO param);

    TradingParamMO selectTradingParam(String orderNo);

    CountOrderMO countOrder(CountOrderPO param);

    List<OrderMO> settlementOrderTask();

    OrderTransactionMO selectOrderTransactionByParam(CountOrderSettlementParamDTO parseObject);

    List<DetailEarningListMO> transactionList(DistributionOrdersParamDTO param);

    TransactionDetailMO transactionDetail(DistributionOrdersParamDTO param);

    List<SillysoftResultMO> selectSillysoft(ChannelCurveParamDTO param);

    List<SellHotWeekMO> sellHot(SellHotParamDTO paramDTO);

    TodayAndAllSellMO selectTodayAndAllSell(CountOrderParamDTO dto);

    TodayAndAllSellMO selectPusherTodayAndAllSell(CountOrderParamDTO dto);

    List<OrderMO> autoCanelOrder();

    TodayAndAllSellMO sumOrderMoney(CountOrderSettlementParamDTO dto);

    SalesAndEarningsMO selectOrderCntByParam(OrderParamMO orderParamMO);

    TodayAndAllSellMO merchantOrderMoney(CountOrderParamDTO dto);
    List<Long> selectOrderIdListByParam(OrderParamMO orderParamMO);
}
